package com.kangye.learnstudent.service.impl;

import com.kangye.learnstudent.entity.QuestionBank;
import com.kangye.learnstudent.entity.User;
import com.kangye.learnstudent.mapper.QuestionBankMapper;
import com.kangye.learnstudent.service.QuestionBankService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @program: learndeduo
 * @description: 实现题库逻辑接口
 * @author: 索腾龙
 * @create: 2021-05-17 11:04
 **/
@Service
@Transactional
public class QuestionBankServiceImpl implements QuestionBankService {
    @Autowired
    private QuestionBankMapper questionBankMapper;

    //随机获取单选题
    @Override
    public List<QuestionBank> selectpaper1(Integer dropdown1, Integer dropdown2,User user) {
        List<QuestionBank> list = questionBankMapper.selectpaper1(dropdown1,dropdown2,user);
        if (list.size()>0){
            return list;
        }
        return null;
    }
    //随机获取多选题
    @Override
    public List<QuestionBank> selectpaper2(Integer dropdown1,Integer dropdown3,User user) {
        List<QuestionBank> list = questionBankMapper.selectpaper2(dropdown1,dropdown3,user);
        if (list.size()>0){
            return list;
        }
        return null;
    }
    //随机获取简答题
    @Override
    public List<QuestionBank> selectpaper3(Integer dropdown1,Integer dropdown4, User user) {
        List<QuestionBank> list = questionBankMapper.selectpaper3(dropdown1,dropdown4,user);
        if (list.size()>0){
            return list;
        }
        return null;
    }

}